package cn.singno.springBoot.demo.ch08_event;

import org.springframework.context.ApplicationEventPublisher;
import org.springframework.context.ApplicationEventPublisherAware;
import org.springframework.stereotype.Component;

@Component
public class DemoPulisher2 implements ApplicationEventPublisherAware
{
	private ApplicationEventPublisher applicationEventPublisher = null;
	
	@Override
        public void setApplicationEventPublisher(ApplicationEventPublisher applicationEventPublisher)
        {
		this.applicationEventPublisher = applicationEventPublisher;
        }

	public void publish(String msg){
		applicationEventPublisher.publishEvent(new DemoEvent(this, msg));
	}
}
